package com.jichangxiu.server.platform.entity.po;

import com.baomidou.mybatisplus.annotation.*;
import com.jichangxiu.common.entity.po.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@TableName("platform_user")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
@Schema(description = "用户实体")
public class PlatformUser extends BaseEntity implements Serializable {

    @Schema(description = "用户ID")
    @TableId(value = "user_id", type = IdType.ASSIGN_UUID)
    private String userId;

    @TableField("username")
    @Schema(description = "用户账号")
    private String username;

    @TableField("password")
    @Schema(description = "用户密码")
    private String password;

    @TableField("user_no")
    @Schema(description = "用户编码")
    private String userNo;

    @TableField("user_code")
    @Schema(description = "用户标识")
    private String userCode;

    @TableField("dept_id")
    @Schema(description = "部门ID")
    private String deptId;

    @TableField("nick_name")
    @Schema(description = "用户昵称")
    private String nickName;

    @TableField("phone")
    @Schema(description = "联系电话")
    private String phone;

    @TableField("email")
    @Schema(description = "联系邮箱")
    private String email;

    @TableField("sex")
    @Schema(description = "用户性别（0女 1男 2未知）")
    private Long sex;

    @TableField("avatar")
    @Schema(description = "头像地址")
    private String avatar;

    @TableField("login_ip")
    @Schema(description = "最后登录IP")
    private String loginIp;

    @TableField("login_date")
    @Schema(description = "最后登录时间")
    private Date loginDate;

    @TableField("pwd_update_date")
    @Schema(description = "密码最后更新时间")
    private Date pwdUpdateDate;

    @TableField("tenant_id")
    @Schema(description = "租户ID")
    private String tenantId;

    @TableField("remark")
    @Schema(description = "备注")
    private String remark;

    @TableField("status")
    @Schema(description = "状态（false停用 true正常）")
    private Boolean status;

    @TableLogic
    @TableField("deleted")
    @Schema(description = "是否删除（0否 1是）")
    private String deleted;

    @TableField(exist = false)
    @Schema(description = "租户名称")
    private String tenantName;

    @TableField(exist = false)
    @Schema(description = "用户角色列表")
    private List<PlatformRole> platformRoles;

    @TableField(exist = false)
    @Schema(description = "用户权限列表")
    private List<PlatformMenuPower> platformMenuPowers;

}
